package com.spaceobj.chess.entity;

import lombok.Data;

@Data
public class UserSession {
    private Integer userId;
    private String matchStatus;
    private Long lastHeartbeat;
    private Integer currentGameId;
    private String status;  // 在线、离线、游戏中

    public UserSession(Integer userId) {
        this.userId = userId;
        this.lastHeartbeat = System.currentTimeMillis();
        this.status = "在线";
    }

    public boolean isValid() {
        return System.currentTimeMillis() - lastHeartbeat < 60000;
    }
} 